<template>
  <view class="login-container">
    <!-- 顶部导航 -->
    <view class="nav-bar">
      <text class="page-title">登录</text>
    </view>

    <!-- 学校信息 -->
    <view class="header">
      <image class="logo" src="/static/image/logo.png"></image>
      <text class="school-name">广东理工职业学院</text>
    </view>

    <!-- 登录表单 -->
    <view class="form">
      <view class="input-group">
        <image class="icon" src="/static/image/user.jpg"></image>
        <input 
          type="text" 
          v-model="username" 
          placeholder="请输入账号" 
          placeholder-class="placeholder-style"
        />
      </view>

      <view class="input-group">
        <image class="icon" src="/static/image/password.jpg"></image>
        <input 
          type="password" 
          v-model="password" 
          placeholder="请输入密码" 
          placeholder-class="placeholder-style"
        />
      </view>

      <view class="remember-group">
        <checkbox            
          color="#007AFF"
        />
        <text class="remember-text">记住密码</text>
      </view>

      <button class="login-btn" @click="handleLogin">登录</button>
    </view>
  </view>
</template>

<script setup>
	export default {
	  data() {
	    return {
	      username: '',
	      password: '',
	      remember: false
	    }
	  },
	  methods: {
	    handleLogin() {
	      if (this.username !== 'admin' || this.password !== '123456') {
	        uni.showToast({ title: '账号或密码错误', icon: 'none' });
	        return;
	      }
	
	      uni.switchTab({
	        url: '/pages/index/index',
	      });
	    },
	  }
	}
</script>

<style lang="scss" lscoped>
.login-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #fff;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88rpx;
  padding: 0 30rpx;
  position: relative;
}

.close-btn {
  position: absolute;
  left: 30rpx;
  font-size: 48rpx;
  color: #333;
}

.page-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 80rpx 0;
}

.logo {
  width: 200rpx;
  height: 200rpx;
  margin-bottom: 30rpx;
}

.school-name {
  font-size: 40rpx;
  font-weight: bold;
  color: #ff0000;
  margin-bottom: 15rpx;
}

.form {
  padding: 0 60rpx;
}

.input-group {
  display: flex;
  align-items: center;
  border: 1rpx solid #eee;
  border-radius: 20px;
  background: #eee;
  padding: 25rpx 0;
  margin-bottom: 40rpx;
}

.icon {
  width: 44rpx;
  height: 44rpx;
  margin-right: 25rpx;
}

input {
  flex: 1;
  font-size: 32rpx;
  color: #333;
}

.placeholder-style {
  color: #999;
}

.remember-group {
  display: flex;
  align-items: center;
  margin: 20rpx 0 60rpx;
}

.remember-text {
  font-size: 30rpx;
  color: #666;
  margin-left: 15rpx;
}

.login-btn {
  width: 100%;
  height: 90rpx;
  background-color: #007AFF;
  color: #fff;
  font-size: 36rpx;
  border-radius: 45rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>